<?php

namespace app\common\model;

use think\facade\Db;
use think\Model;

class Banner extends Model
{
    /**
     * Use Thinkphp ORM Model
     */

    protected $autoWriteTimestamp = 'int';

    
    public static function getBanner($status = null)
    {
        $query = new Banner();
        if($status)
        {
            $query->where('status', $status);
        }

        $data['total'] = $query->count('id');
        $data['list']  = $query->order(['sort'=>'asc', 'id'=>'desc'])->select();

        return $data;
    }
}